package com.yc.sole.code.generator;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.generator.config.ITypeConvert;
import com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;

/**
 * 代码生成器配置类
 *
 * @author yizuomin
 * @date 2022/11/22 19:28
 **/
@Data
public class ConfigProperty {
    /**
     * 必填项：用来生成文件的模板的位置(resources目录下):
     */
    private String controllerTemplateLocation = null;
    private String entityTemplateLocation = null;
    private String mapperTemplateLocation = null;
    private String bizTemplateLocation = null;
    private String serviceTemplateLocation = null;
    private String serviceImplTemplateLocation = null;
    private String repositoryTemplateLocation = null;
    private String dtoTemplateLocation = null;
    private String reqTemplateLocation = null;
    private String respTemplateLocation = null;
    private String queryReqTemplateLocation = null;

    /**
     * 必填项：包路径，在src/main/java下的包路径，最后一个小数点后面的名字会作为模块名
     */
    private String controllerPackagePath;
    private String mapperPackagePath;
    private String servicePackagePath;
    private String serviceImplPackagePath;
    private String repositoryPackagePath;
    private String xmlPackagePath;
    private String bizPackagePath;
    private String entityPackagePath;
    private String dtoPackagePath;
    private String testPackagePath;
    private String reqPackagePath;
    private String queryReqPackagePath;
    private String respPackagePath;

    /**
     * 选填项：是否采用swagger2生成
     */
    private boolean swagger2 = false;

    /**
     * 选填项：根包名
     */
    private String rootPackagePath;

    /**
     * 选填项：模块名
     */
    private String moduleName;

    /**
     * 异常类
     */
    private String exceptionName;

    /**
     * 异常类参数Enum
     */
    private String exceptionCode;

    /**
     * 必填项：要生成代码的数据库表名称（不区分大小写）
     */
    private String[] tables;

    /**
     * 必填项：生成文件输出路径
     */
    private String outFilePath;

    /**
     * 以下四个字段：必填项
     * data source config
     */
    private String dbUrl;
    private String dbDriverName;
    private String dbUsername;
    private String dbPassword;
    private DbType dbType;
    private ITypeConvert dbTypeConvert;

    /**
     * 可选项：表前缀
     */
    private String[] tablePrefix;

    /**
     * 可选项：类注释中的@author的值
     */
    private String author;

    /**
     * 以下五个字段: 可选项
     * 生成的类继承的父类
     */
    private Class<?> superEntityClass;
    private Class<?> superDaoClass;
    private Class<?> superServiceClass;
    private Class<?> superServiceImplClass;
    private Class<?> superControllerClass;

    /**
     * 可选项： 与superEntityClass同时使用，父类中的公共字段数据库列名（不区分大小写）
     */
    private String[] superEntityColumns;

    @Setter(AccessLevel.NONE)
    private AbstractTemplateEngine templateEngine = new VelocityTemplateEngine();

    @Setter(AccessLevel.NONE)
    private String templateSuffix = ".vm";

}
